<template>
<!-- 客户信息管理 -->
    <div>
      <el-container>
         <el-header style="padding: 0px;display:flex;justify-content:space-between;align-items: center">
          <div style="display: inline">
            <el-input
            placeholder="请输入合同编号"
            clearable
            style="width: 300px;margin: 0px;padding: 0px;"
            size="mini"
            :disabled="advanceSearchViewVisible"
            @keyup.enter.native="searchEmp"
            prefix-icon="el-icon-search"
            v-model="contractNo">
            </el-input>
            <el-button type="primary" size="mini" style="margin-left: 5px"
              icon="el-icon-search" @click="searchEmp" :disabled="advanceSearchViewVisible">搜索
            </el-button>
            <el-button slot="reference" type="primary" size="mini" style="margin-left: 5px"
              @click="showAdvanceSearchView">
              <i class="fa fa-lg" v-bind:class="[advanceSearchViewVisible ? faangledoubleup:faangledoubledown]"
                style="margin-right: 5px"></i>高级搜索
            </el-button>
          </div>
          <div style="margin-left: 5px;margin-right: 20px;display: inline">
            <el-upload
              class="upload-demo fl"
              action="/customer/importCustomerInfo"
              :disabled="uploadLoding"
              :show-file-list="false"
              :before-upload="beforeUpload"
              :on-change="uploadChange"
              :on-success="uploadSuccess"
              :on-error="uploadError"
            >
              <el-button type="success" size="mini" v-if="adminRole" :loading="uploadLoding">
                <i class="el-icon-upload2" style="margin-right: 5px"></i>导入客户信息
              </el-button>
            </el-upload>
            <el-button type="success" size="mini" @click="exportInfo"  :disabled="exportLoading" :loading="exportLoading" class="fl" style="margin:0 15px;">
              <i class="el-icon-download" style="margin-right: 5px"></i>导出客户信息
            </el-button>
          </div>
         </el-header>
        <el-main>
          <!-- 高级搜索 -->
          <transition name="slide-fade">
            <div v-show="advanceSearchViewVisible" class="senior"> 
                <el-row>
                  <el-col :span="8">
                      <span>服务人员:</span>
                      <el-select
                        v-model="senior.salemanName"
                        filterable
                        remote
                        placeholder="请输入服务人员"
                        :remote-method="inputsalemanNameMethod"
                        :loading="senior.inputsalemanNameLoading"
                        @change="salemanNameChange" clearable>
                        <el-option
                          v-for="item in senior.inputsalemanNameArray"
                          :key="item.salemanId"
                          :label="item.area+item.part+item.group+item.salemanName"
                          :value="item.salemanName"
                        >
                        </el-option>
                      </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>合同状态:</span>
                    <el-select v-model="senior.statusList" multiple placeholder="请选择">
                      <el-option
                        v-for="item in senior.statusArray"
                        :key="item"
                        :label="item"
                        :value="item">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>客户姓名:</span>
                    <el-input
                      placeholder="请输入姓名"
                      v-model="senior.customerName"
                      clearable>
                    </el-input>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                      <span>身份证:</span>
                      <el-input
                        placeholder="请输入身份证"
                        v-model="senior.idcard"
                        clearable>
                      </el-input>
                  </el-col>
                  <el-col :span="8">
                    <span>产品名称:</span>
                    <el-select
                        v-model="senior.productName"
                        filterable
                        remote
                        multiple
                        :reserve-keyword="true"
                        placeholder="请输入产品名称"
                        :remote-method="inputProductNameMethod"
                        :loading="senior.inputProductNameLoading"
                        @change="productNameChange" clearable>
                        <el-option
                          v-for="item in senior.productNameArray"
                          :key="item.productId"
                          :label="item.productName+' '+item.productNo"
                          :value="item.productName"
                        >
                        </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>资产转让生效日:</span>
                    <el-date-picker
                      v-model="senior.AssetsTransferEffDate"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                    >
                    </el-date-picker>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <span>录入时间段:</span>  
                    <el-date-picker
                      v-model="senior.InputTime"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                    >
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8" class="tr">
                    <span>回执回销时间段:</span>  
                    <el-date-picker
                      v-model="senior.ReceiptSellBackTime"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                      >
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8" class="tr">
                    <span>最迟退出日:</span>    
                    <el-date-picker
                      v-model="senior.LastInvestmentExitTiem"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                      >
                    </el-date-picker>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8" class="tr">
                    <span>银行到账日期:</span>    
                    <el-date-picker
                      v-model="senior.BankReceivedDate"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                      >
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8" class="tr">
                    <span>实际投资退出日:</span>    
                    <el-date-picker
                      v-model="senior.RealInvestmentExitDate"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                      >
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8">
                    <span>手机号:</span>  
                    <el-input
                        placeholder="请输入手机号"
                        v-model="senior.phone"
                        clearable>
                      </el-input>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <span>录入人：</span>
                    <el-select v-model="senior.createdIdList" multiple placeholder="请选择录入人">
                      <el-option
                        v-for="item in senior.createdManArray"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>新老客户：</span>
                    <el-select v-model="senior.customerType" clearable placeholder="请选择新老用户">
                      <el-option
                        v-for="item in senior.customerTypeArray"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span class="demonstration">出生日期:</span>  
                    <el-date-picker
                      v-model="senior.age"
                      type="daterange"
                      value-format="yyyy-MM-dd"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期">
                    </el-date-picker>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <span>性别:</span>
                    <el-select v-model="senior.sex" clearable placeholder="请选择性别">
                      <el-option
                        v-for="item in senior.sexArray"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>付款方式:</span>
                    <el-select v-model="senior.investmentType" clearable multiple placeholder="请选择投资方式">
                      <el-option
                        v-for="item in senior.investmentTypeArray"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>部门:</span>
                    <el-select v-model="senior.department" clearable placeholder="请选择部门">
                      <el-option
                        v-for="item in senior.departmentArray"
                        :key="item"
                        :label="item"
                        :value="item">
                      </el-option>
                    </el-select>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-button icon="el-icon-search" type="primary" size="mini" @click="search">搜索</el-button>
                    <el-button size="mini" @click="cancelSearch">取消</el-button>
                  </el-col>
                </el-row>  
            </div>
          </transition>
          <!-- 表单列表 -->
          <div>
            <el-table
              :data="table"
              v-loading="tableLoading"
              border
              stripe 
              size="mini"
              height="500"
              :highlight-current-row="true"
              :row-class-name="tableRowClassName"
              style="width: 100%">
              <el-table-column
                label="合同编号"
                prop="contractNo"
                align="center"
                fixed
                width="200">
              </el-table-column>
              <el-table-column
                align="center"
                prop="createdTime"
                label="录入时间"
                width="150">
              </el-table-column>
               <el-table-column
                width="180"
                align="center"
                fixed
                label="产品名称"
                prop="productName">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="录入人"
                prop="createdBy">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                fixed
                label="资产受让人"
                prop="customerName">
              </el-table-column>
              <el-table-column
                align="center"
                width="70"
                label="新老客户"
                prop="customerType">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="身份证号"
                prop="idCard">
              </el-table-column>
              <el-table-column
                width="100"
                label="生日"
                align="center"
                prop="birthday">
              </el-table-column>
              <el-table-column
                label="年龄"
                align="center"
                prop="age">
              </el-table-column>
              <el-table-column
                label="性别"
                prop="sex"
                align="center">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="联系电话"
                prop="telPhone">
              </el-table-column>
              <el-table-column
                width="300"
                align="center"
                label="联系地址"
                prop="address">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                label="打款账号"
                prop="payBankCard">
              </el-table-column>
              <el-table-column
                width="220"
                align="center"
                label="打款银行开户行"
                prop="payOpeningBank">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                label="收款账号"
                prop="receiveBankCard">
              </el-table-column>
              <el-table-column
                align="center"
                width="220"
                label="收款银行开户行"
                prop="receiveOpeningBank">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="资产转让总额"
                prop="totalAssets">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账金额"
                prop="bankEceivedAmount">
              </el-table-column>
              <el-table-column
                align="center"
                label="付款方式"
                prop="investmentType">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行手续费"
                prop="bankFee">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="预期收益率(%)"
                prop="returnRate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行打款日期"
                prop="payDate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账日期"
                prop="bankReceivedDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="资产转让生效日"
                prop="assetsTransferEffDate">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="服务人员"
                prop="salemanInfo.salemanName">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="组"
                prop="salemanInfo.group">
              </el-table-column> 
              <el-table-column
                width="95"
                align="center"
                label="部"
                prop="salemanInfo.part">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="区"
                prop="salemanInfo.area">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="部门"
                prop="department">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期投资退出日"
                prop="expectInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期退出天数"
                prop="lastInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="投资者预期收益"
                prop="expectInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期分配总额"
                prop="expectTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="expectTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="实际投资期限"
                prop="actualInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日"
                prop="realInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="投资者实际收益"
                prop="realInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日本息总额"
                prop="realTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="realTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome1"
                label="预期第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome2"
                label="预期第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome3"
                label="预期第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome4"
                label="预期第四期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome1"
                label="实际第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome2"
                label="实际第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome3"
                label="实际第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome4"
                label="实际第四期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="财顾费总额"
                prop="totalPcFee">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第一年折标系数"
                prop="standardCoefficient">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第二年折标系数"
                prop="standardCoefficientSub">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第三年折标系数"
                prop="standardCoefficientSub3">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第四年折标系数"
                prop="standardCoefficientSub4">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第一年标准业绩"
                prop="standardCoefficientFee">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第二年标准业绩"
                prop="standardCoefficientFee2">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第三年标准业绩"
                prop="standardCoefficientFee3">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第四年标准业绩"
                prop="standardCoefficientFee4">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第一年积分"
                prop="integral">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第二年积分"
                prop="integral2">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第三年积分"
                prop="integral3">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第四年积分"
                prop="integral4">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续投资金额"
                prop="subsistTotalRevenue">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续标准业绩"
                prop="subsistCoefficient">
              </el-table-column>      
              <el-table-column
                align="center"
                width="150"
                label="是否启用试算数据"
                prop="isEnableTrialData">
              </el-table-column> 
              <el-table-column
                align="center"
                width="150"
                label="财务审核时间"
                prop="financeCheckTime">
              </el-table-column>   
              <el-table-column
                width="150"
                align="center"
                label="风控审核时间"
                prop="riskerCheckTime">
              </el-table-column>     
              <el-table-column
              width="150"
                align="center"
                label="回执回销状态"
                prop="receiptSellBackFlagCn">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="回执回销时间"
                prop="receiptSellBackTime">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="回执回销确认时间"
                prop="receiptSellConfirmTime">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="驳回时间"
                prop="rejectionTime"
                >
              </el-table-column>
              <el-table-column
                width="200"
                align="center"
                label="驳回理由"
                prop="remark"
                :show-overflow-tooltip="true">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="确认书下载次数"
                prop="exportTimes">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="确认书下载人"
                prop="exportName">
              </el-table-column>
              <el-table-column
                align="center"
                width="120"
                label="合同状态"
                fixed="right"
                prop="status">
              </el-table-column>
              <el-table-column
                align="center"
                width="120"
                label="回执回销确认状态"
                prop="receiptSellBackFlagCn"
                fixed="right">
              </el-table-column>
              <el-table-column
                fixed="right"
                align="center"
                label="操作"
                width="150">
                <template slot-scope="scope">
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" type="primary"
                    size="mini" @click="showEditEmpView(scope.row)">查看信息
                  </el-button>
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" 
                  type="warning" size="mini" @click=editEmpView(scope.row) v-if="adminRole">修改信息</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination
                background
                :page-size="pageSize"
                :current-page="currentPage"
                @current-change="currentChange"
                layout="prev, pager, next"
                :total="totalCount"
                style="margin:50px;">
            </el-pagination>
            <div style="margin:30px 0;" class="fw">共{{Math.ceil(totalCount/pageSize)}}页,{{totalCount}}条信息</div>
          </div>
        </el-main>
        <!-- 查看信息 -->
        <template>
          <el-dialog title="查看信息" :visible.sync="dialogFormVisible" 
            v-loading="dialogLoading"
            :close-on-click-modal="false"
            width="1100px"
            >
            <el-form :model="form"  ref="form">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="合同编号:">
                      {{form.contractNo}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="产品名称:" >
                    {{form.productName}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第一年标准折标系数:" >
                    {{form.standardCoefficient}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第二年标准折标系数:" >
                    {{form.standardCoefficientSub}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第三年标准折标系数:" >
                    {{form.standardCoefficientSub3}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第四年标准折标系数:" >
                    {{form.standardCoefficientSub4}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="资产受让人:">
                      {{form.customerName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="身份证号:">
                      {{form.idCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="新老客户:">
                      {{form.customerType}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="生日:">
                      {{form.birthday}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="年龄:">
                      {{form.age}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="性别:">
                      {{form.sex}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款账号:">
                      {{form.payBankCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款账号:">
                      {{form.receiveBankCard}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款银行开户行:">
                      {{form.payOpeningBank}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款银行开户行:">
                      {{form.receiveOpeningBank}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="联系电话:">
                      {{form.telPhone}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="联系地址:">
                      {{form.address}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="付款方式:" prop="investmentType">
                      {{form.investmentType}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="资产转让总额:"  prop='totalAssets'>
                      {{form.totalAssets}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="预期收益率:">
                    {{form.totalAssetsReturn}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="服务人员:" prop="salemanName">
                      {{form.salemanName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="部门:">
                      {{form.department}}
                  </el-form-item>
                </el-col>
                <el-col :span="8" v-if="form.receiptSellBackTime!=null">
                  回执回销时间：{{form.receiptSellBackTime}}
                </el-col>  
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="银行到账金额:">
                        {{form.bankEceivedAmount}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="手续费:">
                        {{form.bankFee}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="银行到账日期:">
                        {{form.bankReceivedDate}}
                    </el-form-item>
                </el-col>
                </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="财顾费:" prop="salemanName">
                      {{form.totalPcFee}}
                  </el-form-item>
                </el-col>  
                <el-col :span="8">
                    <el-form-item label="银行打款日期:">
                        {{form.payDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="是否启用试算数据:">
                      {{form.isEnableTrialData}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="资产转让生效日:">
                       {{form.assetsTransferEffDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期投资退出日:">
                       {{form.expectInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期退出天数:">
                       {{form.lastInvestmentExitDate}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="投资者预期收益:">
                       {{form.expectInvestmentIncome}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="预期分配总额:">
                       {{form.expectTotalRevenue}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="人民币（大写）:">
                       {{form.expectTotalRevenueCap}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                    <el-form-item label="预期第一期收益:">
                       {{form.expectInvestmentIncome1}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="预期第二期收益:">
                       {{form.expectInvestmentIncome2}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="预期第三期收益:">
                       {{form.expectInvestmentIncome3}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="预期第四期收益:">
                       {{form.expectInvestmentIncome4}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第一年标准业绩:">
                    {{form.standardCoefficientFee}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第二年标准业绩:">
                    {{form.standardCoefficientFee2}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第三年标准业绩:">
                    {{form.standardCoefficientFee3}}
                  </el-form-item>
                </el-col>
                 <el-col :span="12">
                  <el-form-item label="第四年标准业绩:">
                    {{form.standardCoefficientFee4}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="实际投资退出日:">
                       {{form.realInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="实际投资期限:">
                       {{form.actualInvestmentExitDate}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="投资者实际收益:">
                       {{form.realInvestmentIncome}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="实际投资退出日本息总额:">
                       {{form.realTotalRevenue}}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="人民币（大写）:">
                       {{form.realTotalRevenueCap}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                    <el-form-item label="实际第一期收益:">
                       {{form.realInvestmentIncome1}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="实际第二期收益:">
                       {{form.realInvestmentIncome2}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="实际第三期收益:">
                       {{form.realInvestmentIncome3}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="实际第四期收益:">
                       {{form.realInvestmentIncome4}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="第一年积分:">
                       {{form.integral}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="第二年积分:">
                       {{form.integral2}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="第三年积分:">
                       {{form.integral3}}
                    </el-form-item>
                </el-col>
                 <el-col :span="12">
                    <el-form-item label="第四年积分:">
                       {{form.integral4}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                    <el-form-item label="当前状态:">
                        {{form.status}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="回执回销确认状态:">
                        {{form.receiptSellBackFlagCn}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="备注:">
                        {{form.remark}}
                    </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-dialog>
        </template>
        <!-- 修改信息 -->
        <template>
            <el-dialog title="修改信息" 
              v-loading="dialogLoading"
              :visible.sync="editDialog"
              :close-on-click-modal="false"
              @close="editDialogClose"
              width="1100px">
              <el-form :model="form" :rules="rules" ref="form">
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="合同编号:">
                      {{form.contractNo}}
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="产品名称:" >
                      {{form.productName}}
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="第一年标准折标系数:" >
                    {{form.standardCoefficient}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="第二年标准折标系数:" >
                    {{form.standardCoefficientSub}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第三年标准折标系数:" >
                    {{form.standardCoefficientSub3}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="第四年标准折标系数:" >
                    {{form.standardCoefficientSub4}}
                  </el-form-item>
                </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="资产受让人:" prop='customerName'>
                      <el-autocomplete
                        v-model="form.customerName"
                        :fetch-suggestions="querySearchAsync"
                        placeholder="请输入资产受让人"
                        @select="selectName" clearable
                        style="width:45%;"
                      >
                      <template slot-scope="{ item }">
                        <div class="name">{{ item.value }}</div>
                        <div class="idcard">{{ item.idCard }}</div>
                      </template>
                      </el-autocomplete>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="身份证号:"  prop='idCard'>
                      <el-input type="text" auto-complete="off" placeholder="请输入身份证号" v-model="form.idCard" 
                      clearable  @change="idCardChange">
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="性别:"  prop='sex'>
                        <el-radio v-model="form.sex" label="男">男</el-radio>
                        <el-radio v-model="form.sex" label="女">女</el-radio>  
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="付款方式:">
                      {{form.investmentType}}
                    </el-form-item>
                  </el-col> 
                  <el-col :span="8">
                    <el-form-item label="生日:"  prop='birthday'>
                      <el-date-picker
                        v-model="form.birthday"
                        type="date"
                        placeholder="选择日期"
                        value-format="yyyy-MM-dd"
                        :picker-options="birthdayOptions">
                      </el-date-picker>
                    </el-form-item>
                  </el-col>
                  <!-- <el-col :span="8">
                    <el-form-item label="年龄:"  prop='age'>
                      <el-input type="text" auto-complete="off" placeholder="请输入年龄" v-model="form.age" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col> -->
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="打款账号:"  prop='payBankCard'>
                      <el-input type="text" auto-complete="off" placeholder="请输入打款账号" v-model="form.payBankCard" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="收款账号:"  prop='receiveBankCard'>
                      <el-input type="text" auto-complete="off" placeholder="请输入收款账号" v-model="form.receiveBankCard" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12" class="longinput">
                    <el-form-item label="联系电话:"  prop='telPhone'>
                      <el-input type="text" auto-complete="off" placeholder="请输入联系电话" v-model="form.telPhone" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" class="longinput">
                    <el-form-item label="联系地址:"  prop='address'>
                      <el-input type="text" auto-complete="off" placeholder="请输入联系地址" v-model="form.address" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>  
                </el-row>
                <el-row>
                  <el-col :span="12" class="longinput">
                    <el-form-item label="打款银行开户行:"  prop='payOpeningBank'>
                      <el-input type="text" auto-complete="off" placeholder="请输入打款银行开户行" v-model="form.payOpeningBank" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12" class="longinput">
                    <el-form-item label="收款银行开户行:"  prop='receiveOpeningBank'>
                      <el-input type="text" auto-complete="off" placeholder="请输入收款银行开户行" v-model="form.receiveOpeningBank" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>   
                  <el-col :span="8">
                    <el-form-item label="资产转让总额:">
                      {{form.totalAssets}}
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="服务人员:">
                      {{form.salemanName}}
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="部门:">
                      {{form.department}}
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-form-item label="银行打款日期:">
                      {{form.payDate}}
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    回执回销时间：{{form.receiptSellBackTime}}
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="回执回销确认状态:">
                        {{form.receiptSellBackFlagCn}}
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    新老客户：{{form.customerType}}
                </el-col>
                  <el-col :span="8">
                    <el-form-item label="预期收益率:">
                      {{form.totalAssetsReturn}}
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="备注:"  prop='remark'>
                      <el-input type="text" auto-complete="off" placeholder="请输入备注" v-model="form.remark" 
                       clearable>
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-row>   
              </el-form>
              <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="sureEdit('form')">确 定</el-button>
                <el-button @click="editDialog=false">取 消</el-button>
              </div>
            </el-dialog>
          </template>
      </el-container>
    </div>
</template>
<script>
var contractId = -1;
var salemanId = "";
var productId = "";
var productIdList=[];
var ageStart="";
var ageEnd="";
var searchInfo={
  contractNo:"",
  salemanId:"",
  status:"",
  statusList:[],
  customerName:"",
  idCard:"",
  phone:"",
  productId:"",
  productIdList:[],
  startAssetsTransferEffDate:"",
  endAssetsTransferEffDate:"",
  startInputTime:"",
  endInputTime:"",
  startReceiptSellBackTime:"",
  endReceiptSellBackTime:"",
  startLastInvestmentExitTiem:"",
  endLastInvestmentExitTiem:"",
  startBankReceivedDate:"",
  endBankReceivedDate:"",
  startRealInvestmentExitDate:"",
  endRealInvestmentExitDate:"",
  createdId:"",
  createdIdList:[],
  customerType:"",
  ageStart:"",
  ageEnd:"",
  sex:"",
  investmentType: [],
  department:"",
}
var nameArray=[];
export default {
  data() {
    return {
      exportLoading:false,
      adminRole:false,
      contractNo: "",
      advanceSearchViewVisible: false,
      faangledoubleup: "fa-angle-double-up",
      faangledoubledown: "fa-angle-double-down",
      dialogFormVisible: false,  
      editDialog:false,
      dialogLoading: false,
      realInvestmentExitDateShow:false,
      birthdayOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        }
      },
      form: {
        contractNo: "",
        productName: "",
        standardCoefficient: 0,
        customerName: "",
        idCard: "",
        sex: "男",
        birthday: "",
        age: "",
        payBankCard: "",
        receiveBankCard: "",
        payOpeningBank: "",
        receiveOpeningBank: "",
        telPhone: "",
        address: "",
        totalAssets: "",
        totalAssetsReturn: 0,
        investmentType: [],
        salemanName: "",
        bankEceivedAmount: "",
        bankFee: "",
        bankReceivedDate: "",
        remark: "",
        assetsTransferEffDate: "",
        expectInvestmentExitDate: "",
        lastInvestmentExitDate: 0,
      },
      // 高级搜索
      senior:{
        saleman: "",
        inputsalemanNameLoading: false,
        inputProductNameLoading:false,
        inputsalemanNameArray: [],
        productNameArray:[],
        status:"",
        statusList:[],
        statusArray:[],
        customerName:"",
        idcard:"",
        productName:"",
        AssetsTransferEffDate:"",
        InputTime:"",
        ReceiptSellBackTime:"",
        LastInvestmentExitTiem:"",
        BankReceivedDate:"",
        RealInvestmentExitDate:"",
        phone:"",
        createdId:"",
        createdIdList:[],
        createdManArray:[],
        customerType:"",
        customerTypeArray:[
          {
            name:"新客户",
            value:"新客户",
          },
          {
            name:"老客户",
            value:"老客户",
          },
        ],
        age:"",
        sex:"",
        sexArray:[
          {
            name:"男",
            value:"男",
          },
          {
            name:"女",
            value:"女",
          },
        ],
        investmentType: [],
        investmentTypeArray: [
          {
            value: "网银",
            label: "网银"
          },
          {
            value: "POS1",
            label: "POS1"
          },
          {
            value: "POS2",
            label: "POS2"
          },
          {
            value: "POS3",
            label: "POS3"
          },
          {
            value: "银行柜面",
            label: "银行柜面"
          },
          {
            value: "代付",
            label: "代付"
          }
        ],
        department:"",
        departmentArray:"",
      },
      uploadLoding:false,
      table: [],
      tableLoading: false,
      currentPage: 1,
      pageSize: 20,
      totalCount: 0,
      tableSearchModel: "common",
      receiptSellBackTime: "",
      rules: {
        contractNo: [
          { required: true, message: "请输入合同编号", trigger: "blur" }
        ],
        customerName: [
          { required: true, message: "请输入资产受让人", trigger: "blur" }
        ],
        idCard: [
          { required: true, message: "请输入身份证号", trigger: "blur" }
        ],
        birthday: [{ required: true, message: "请输入生日", trigger: "blur" }],
        payBankCard: [
          { required: true, message: "请输入打款账号", trigger: "blur" }
        ],
        receiveBankCard: [
          { required: true, message: "请输入收款账号", trigger: "blur" }
        ],
        payOpeningBank: [
          { required: true, message: "请输入打款银行开户行", trigger: "blur" }
        ],
        receiveOpeningBank: [
          { required: true, message: "请输入收款银行开户行", trigger: "blur" }
        ],
        telPhone: [
          { required: true, message: "请输入联系电话", trigger: "blur" }
        ],
        address: [
          { required: true, message: "请输入联系地址", trigger: "blur" }
        ],
      },
    };
  },
  mounted() {
    this.getRequest("/common/user/id/" + this.$store.state.user.id).then(
      resp => {
        if (resp && resp.status == 200) {
          for (var i = 0; i < resp.data.roles.length; i++) {
            if(resp.data.roles[i].nameZh=='系统管理员' || resp.data.roles[i].nameZh.indexOf('风控')!=-1){
              this.adminRole=true
              break;
            }
            else{
              this.adminRole=false
            }
          }
        }
      }
    );
    this.getRequest("/common/getStatusList").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.senior.statusArray=resp.data.obj
        }
      }
    );
    this.getRequest("/common/getAllUser").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.senior.createdManArray=resp.data.obj
        }
      }
    );
    this.getRequest("/auditor/getDepartmentList").then(resp=>{
      if(resp &&resp.data.status==200){
        this.senior.departmentArray=resp.data.obj
      }
    })
    this.initData();
  },
  methods: {
    tableRowClassName({row, rowIndex}){     
      if(rowIndex==0){
        
      }
    },
    initData: function() {
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    // 请求列表数据
    requestTableInfo: function(model, pageCount, pageSize) {
      var that = this;
      //根据合同编号搜查的普通模式
      if (model == "common") {
        that.tableLoading = true;
        that
          .postRequest("/customer/queryContract", {
            contractNo: that.contractNo,
            pageIndex: pageCount,
            pageSize: pageSize
          })
          .then(resp => {
            that.tableLoading = false;
            if (resp && resp.data.status == 200) {
              that.table = resp.data.obj.rows;
              that.totalCount = resp.data.obj.total;
              searchInfo={
                contractNo:that.contractNo,
                salemanId:"",
                status:"",
                statusList:[],
                customerName:"",
                idCard:"",
                phone:"",
                productId:"",
                productIdList:[],
                startAssetsTransferEffDate:"",
                endAssetsTransferEffDate:"",
                startInputTime:"",
                endInputTime:"",
                startReceiptSellBackTime:"",
                endReceiptSellBackTime:"",
                startLastInvestmentExitTiem:"",
                endLastInvestmentExitTiem:"",
                startBankReceivedDate:"",
                endBankReceivedDate:"",
                startRealInvestmentExitDate:"",
                endRealInvestmentExitDate:"",
                createdId:"",
                createdIdList:[],
                customerType:"",
                ageStart:"",
                ageEnd:"",
                sex:"",
                investmentType:[],
                department:"",
              }
            }
          });
      } else if (model == "senior") {
        //高级搜索模式
        this.senior.AssetsTransferEffDate=this.senior.AssetsTransferEffDate ||[];
        this.senior.InputTime=this.senior.InputTime ||[];
        this.senior.ReceiptSellBackTime=this.senior.ReceiptSellBackTime ||[];
        this.senior.LastInvestmentExitTiem=this.senior.LastInvestmentExitTiem ||[];
        this.senior.BankReceivedDate=this.senior.BankReceivedDate ||[];
        this.senior.RealInvestmentExitDate=this.senior.RealInvestmentExitDate ||[];
        this.senior.AssetsTransferEffDate[0]=this.senior.AssetsTransferEffDate[0] || "";
        this.senior.AssetsTransferEffDate[1]=this.senior.AssetsTransferEffDate[1] || "";
        this.senior.InputTime[0]=this.senior.InputTime[0] || "";
        this.senior.InputTime[1]=this.senior.InputTime[1] || "";
        this.senior.ReceiptSellBackTime[0]=this.senior.ReceiptSellBackTime[0] || "";
        this.senior.ReceiptSellBackTime[1]=this.senior.ReceiptSellBackTime[1] || "";
        this.senior.LastInvestmentExitTiem[0]=this.senior.LastInvestmentExitTiem[0] || "";
        this.senior.LastInvestmentExitTiem[1]=this.senior.LastInvestmentExitTiem[1] || "";
        this.senior.BankReceivedDate[0]=this.senior.BankReceivedDate[0] || "";
        this.senior.BankReceivedDate[1]=this.senior.BankReceivedDate[1] || "";
        this.senior.RealInvestmentExitDate[0]=this.senior.RealInvestmentExitDate[0] || "";
        this.senior.RealInvestmentExitDate[1]=this.senior.RealInvestmentExitDate[1] || "";
        if(this.senior.age){
          ageStart=this.senior.age[0];
          ageEnd=this.senior.age[1];
        }else{
          ageStart="";
          ageEnd="";
        }
        that.tableLoading = true;
        that.postRequest("/customer/queryContract", {
            salemanId: salemanId,
            startInputTime: this.senior.InputTime[0],
            endInputTime: this.senior.InputTime[1],
            startReceiptSellBackTime: this.senior.ReceiptSellBackTime[0],
            endReceiptSellBackTime: this.senior.ReceiptSellBackTime[1],
            startLastInvestmentExitTiem: this.senior.LastInvestmentExitTiem[0],
            endLastInvestmentExitTiem: this.senior.LastInvestmentExitTiem[1],
            startBankReceivedDate: this.senior.BankReceivedDate[0],
            endBankReceivedDate: this.senior.BankReceivedDate[1],
            startRealInvestmentExitDate: this.senior.RealInvestmentExitDate[0],
            endRealInvestmentExitDate: this.senior.RealInvestmentExitDate[1],
            productIdList: productIdList,
            startAssetsTransferEffDate: this.senior.AssetsTransferEffDate[0],
            endAssetsTransferEffDate: this.senior.AssetsTransferEffDate[1],
            customerName: this.senior.customerName,
            idCard: this.senior.idcard,
            statusList: this.senior.statusList,
            telPhone: this.senior.phone,
            createdIdList:this.senior.createdIdList,
            customerType:this.senior.customerType,
            ageStart:ageStart,
            ageEnd:ageEnd,
            sex:this.senior.sex,
            investmentTypeList:this.senior.investmentType,
            department:this.senior.department,
            pageIndex: pageCount,
            pageSize: pageSize
          })
          .then(resp => {
            that.tableLoading = false;
            if (resp && resp.data.status == 200) {
              that.table = resp.data.obj.rows;
              that.totalCount = resp.data.obj.total;
              searchInfo={
                contractNo:"",
                salemanId:salemanId,
                status:this.senior.status,
                statusList:this.senior.statusList,
                customerName:this.senior.customerName,
                idCard:this.senior.idcard,
                phone:this.senior.phone,
                productId:productId,
                productIdList:productIdList,
                startAssetsTransferEffDate:this.senior.AssetsTransferEffDate[0],
                endAssetsTransferEffDate:this.senior.AssetsTransferEffDate[1],
                startInputTime:this.senior.InputTime[0],
                endInputTime:this.senior.InputTime[1],
                startReceiptSellBackTime:this.senior.ReceiptSellBackTime[0],
                endReceiptSellBackTime:this.senior.ReceiptSellBackTime[1],
                startLastInvestmentExitTiem:this.senior.LastInvestmentExitTiem[0],
                endLastInvestmentExitTiem:this.senior.LastInvestmentExitTiem[1],
                startBankReceivedDate:this.senior.BankReceivedDate[0],
                endBankReceivedDate:this.senior.BankReceivedDate[1],
                startRealInvestmentExitDate:this.senior.RealInvestmentExitDate[0],
                endRealInvestmentExitDate:this.senior.RealInvestmentExitDate[1],
                createdId:this.senior.createdId,
                createdIdList:this.senior.createdIdList,
                customerType:this.senior.customerType,
                ageStart:ageStart,
                ageEnd:ageEnd,
                sex:this.senior.sex,
                investmentType:this.senior.investmentType,
                department:this.senior.department,
              }
            }
          });
      }
    },
    //列表当前页改变
    currentChange: function(currentChange) {
      this.currentPage = currentChange;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    //查看列表信息
    showEditEmpView: function(item) {
      // console.log(item)
      this.dialogFormVisible = true;
      this.form = item;
      this.form.totalAssetsReturn = item.returnRate;
      this.form.salemanName = item.salemanInfo.salemanName;
      contractId = item.contractId;
    },
    //修改列表信息
    editEmpView(item){
      // console.log(item)
      this.editDialog=true;
      this.form = item;
      this.form.totalAssetsReturn = item.returnRate;
      this.form.salemanName = item.salemanInfo.salemanName;
      contractId = item.contractId;
    },
    // 点击高级搜索
    showAdvanceSearchView() {
      this.advanceSearchViewVisible = !this.advanceSearchViewVisible;
      this.contractNo = "";
      if (this.tableSearchModel == "common") {
        this.tableSearchModel = "senior";
      } else if (this.tableSearchModel == "senior") {
        this.tableSearchModel = "common";
      }
    },
    //取消高级搜索
    cancelSearch: function() {
      this.advanceSearchViewVisible = false;
      this.tableSearchModel = "common";
    },
    // 普通搜索
    searchEmp: function() {
      this.currentPage = 1;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    //高级搜索
    search: function() {
      this.currentPage = 1;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    // 输入服务人员
    inputsalemanNameMethod: function(query) {
      if (query !== "") {
        this.senior.inputsalemanNameLoading = true;
        this.getRequest("/auditor/matchingSaleman?salemanName=" + query).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.senior.inputsalemanNameArray = resp.data.obj;
            }
            this.senior.inputsalemanNameLoading = false;
          }
        );
      } else {
        this.senior.inputsalemanNameArray = [];
      }
    },
    // 服务人员发生变化
    salemanNameChange: function(e) {
      var that = this;
      if (e == "") {
        salemanId = "";
      } else {
        that.dialogLoading = true;
        this.getRequest("/auditor/matchingSaleman?salemanName=" + e).then(
          resp => {
            that.dialogLoading = false;
            if (resp && resp.data.status == 200) {
              salemanId = resp.data.obj[0].salemanId;
            }
          }
        );
      }
    },
    // 输入产品名称
    inputProductNameMethod(query){
      if (query !== "") {
        this.senior.inputProductNameLoading = true;
        this.postRequest("/common/get_product_info",{
          searchContent:query
        }).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.senior.productNameArray = resp.data.obj;
            }
            this.senior.inputProductNameLoading = false;
          }
        );
      } else {
        this.senior.productNameArray = [];
      }
    },
    // 产品名称发生变化
    productNameChange(e){
      var that = this;
      if (e == "") {
        productId = "";
        productIdList=[];
      } else {
        that.dialogLoading = true;
        productIdList=[];
        for(let i=0;i<e.length;i++){
          this.postRequest("/common/get_product_info",{
            searchContent:e[i]
          }).then(
            resp => {
              that.dialogLoading = false;
              if (resp && resp.data.status == 200) {
                productId = resp.data.obj[0].productId;
                productIdList.push(resp.data.obj[0].productId)
              }
            }
          );
        }
      }
    },
    //导出信息
    exportInfo(){
      this.exportLoading=true;
      var address=`/customer/customer_export_contract?contractNo=${searchInfo.contractNo}&&salemanId=${searchInfo.salemanId}&&startInputTime=${searchInfo.startInputTime}&&endInputTime=${searchInfo.endInputTime}&&startReceiptSellBackTime=${searchInfo.startReceiptSellBackTime}&&endReceiptSellBackTime=${searchInfo.endReceiptSellBackTime}&&startLastInvestmentExitTiem=${searchInfo.startLastInvestmentExitTiem}&&endLastInvestmentExitTiem=${searchInfo.endLastInvestmentExitTiem}&&startBankReceivedDate=${searchInfo.startBankReceivedDate}&&endBankReceivedDate=${searchInfo.endBankReceivedDate}&&productIdList=${searchInfo.productIdList}&&startAssetsTransferEffDate=${searchInfo.startAssetsTransferEffDate}&&endAssetsTransferEffDate=${searchInfo.endAssetsTransferEffDate}&&customerName=${searchInfo.customerName}&&statusList=${searchInfo.statusList}&&idCard=${searchInfo.idCard}&&startRealInvestmentExitDate=${searchInfo.startRealInvestmentExitDate}&&endRealInvestmentExitDate=${searchInfo.endRealInvestmentExitDate}&&telPhone=${searchInfo.phone}&&createdIdList=${searchInfo.createdIdList}&&customerType=${searchInfo.customerType}&&ageStart=${searchInfo.ageStart}&&ageEnd=${searchInfo.ageEnd}&&sex=${searchInfo.sex}&&investmentTypeList=${searchInfo.investmentType}&&department=${searchInfo.department}`; 
      this.common.downloadFile(address,this.exportLoading);
      setTimeout(()=>{
        this.exportLoading=false;
      },3000) 
    },
    //上传前判断
    beforeUpload(file){
        var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)				
				const extension = testmsg === 'xls'
        const extension2 = testmsg === 'xlsx'
        const isLt10M = file.size / 1024 / 1024 < 10
        if(!extension && !extension2) {
          this.common.showToast('warning','上传文件只能是 xls、xlsx格式!')
          this.uploadLoding=false;
        }
        if(!isLt10M) {
          this.common.showToast('warning','上传文件大小不能超过 10MB!')
          this.uploadLoding=false;
        }
        return extension || extension2 && isLt10M
    },
    // 上传文件改变
    uploadChange(file,fileList){
      this.uploadLoding=!this.uploadLoding
    },
    uploadSuccess(response,file,fileList){
      if(response.status==200){
        this.common.showToast('success',response.msg)
        this.currentPage = 1;
        this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
      }else{
        this.common.showToast('warning',response.msg)
      }
    },
    uploadError(response,file,fileList){
      console.log(response)
      // this.common.showToast('error','上传失败')
    },
    //输入资产受让人
    querySearchAsync(queryString, cb) {
      var that = this;
      if (queryString != "") {
        that
          .getRequest("/auditor/matchingCustomer?customerName=" + queryString)
          .then(resp => {
            if (resp && resp.data.status == 200) {
              var results = [];
              var string = resp.data.obj;
              results = queryString
                ? string.filter(this.createStateFilter(queryString))
                : string;
              cb(results);
            }
          });
      } else {
        this.form.phoneDisable = false;
        //当资产受让人被清空的时候，将原来带上的信息清空
        // this.form.idCard = "";
        // this.form.sex = "";
        // this.form.birthday = "";
        // this.form.age = "";
        // this.form.payBankCard = "";
        // this.form.receiveBankCard = "";
        // this.form.payOpeningBank = "";
        // this.form.receiveOpeningBank = "";
        // this.form.telPhone = "";
        // this.form.address = "";
        cb(queryString ? [].filter(this.createStateFilter(queryString)) : []);
      }
    },
    // 搜索匹配资产受让人的过滤器
    createStateFilter(queryString) {
      return state => {
        state.value = state.customerName; //匹配显示的字段必须叫value
        state.idCard = state.idCard;
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        );
      };
    },
    //选择资产受让人
    selectName: function(item) {
      console.log(item)
      this.form.idCard = item.idCard;
      this.form.sex = item.sex;
      this.form.birthday = item.birthday;
      this.form.age = item.age;
      this.form.payBankCard = item.payBankCard;
      this.form.receiveBankCard = item.receiveBankCard;
      this.form.payOpeningBank = item.payOpeningBank;
      this.form.receiveOpeningBank = item.receiveOpeningBank;
      this.form.telPhone = item.telPhone;
      this.form.address = item.address;
    },
    //身份证改变
    idCardChange: function(e) {
      if (e.length == 18) {
        if (e.substring(16, 17) % 2 == 1) {
          this.form.sex = "男";
        } else {
          this.form.sex = "女";
        }

        this.form.birthday =
          e.substring(6, 10) +
          "-" +
          e.substring(10, 12) +
          "-" +
          e.substring(12, 14);
          this.form.age=this.jsGetAge(this.form.birthday)
      } else {
        this.common.showToast("warning", "请输入正确的身份证号");
      }
    },
    //根据出生年月获取年龄
    jsGetAge(strBirthday) {
      var returnAge;
      // 根据生日计算年龄（"1995-09-25"）
      //以下五行是为了获取出生年月日，如果是从身份证上获取需要稍微改变一下
      var strBirthdayArr = strBirthday.split("-");
      var birthYear = strBirthdayArr[0];
      var birthMonth = strBirthdayArr[1];
      var birthDay = strBirthdayArr[2];

      var d = new Date();
      var nowYear = d.getFullYear();
      var nowMonth = d.getMonth() + 1;
      var nowDay = d.getDate();

      if (nowYear == birthYear) {
        returnAge = 0; //同年 则为0岁
      } else {
        var ageDiff = nowYear - birthYear; //年之差
        if (ageDiff > 0) {
          if (nowMonth == birthMonth) {
            var dayDiff = nowDay - birthDay; //日之差
            if (dayDiff < 0) {
              returnAge = ageDiff - 1;
            } else {
              returnAge = ageDiff;
            }
          } else {
            var monthDiff = nowMonth - birthMonth; //月之差
            if (monthDiff < 0) {
              returnAge = ageDiff - 1;
            } else {
              returnAge = ageDiff;
            }
          }
        } else {
          returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天
        }
      }

      return returnAge; //返回周岁年龄
    },
    //确认修改
    sureEdit: function(form) {
      this.$refs[form].validate(valid => {
        if (valid) {
          this.dialogLoading = true;
          var that = this;
          this.putRequest("/customer/update", {
            contractId: contractId,
            contractNo: this.form.contractNo,
            productName: this.form.productName,
            productId: productId,
            totalAssets: this.form.totalAssets,
            investmentType: this.form.investmentType,
            salemanId: salemanId,
            customerName: this.form.customerName,
            idCard: this.form.idCard,
            sex: this.form.sex,
            birthday: this.form.birthday,
            payBankCard: this.form.payBankCard,
            payOpeningBank: this.form.payOpeningBank,
            receiveBankCard: this.form.receiveBankCard,
            receiveOpeningBank: this.form.receiveOpeningBank,
            telPhone: this.form.telPhone,
            address: this.form.address,
            payDate:this.form.payDate,
            remark: this.form.remark
          }).then(resp => {
            that.dialogLoading = false;
            if (resp && resp.data.status == 200) {
              that.editDialog = false;
              that.common.showToast("success", resp.data.msg);
              this.initData();
            }
          });
         
        } else {
          return false;
        }
      });
    },
    editDialogClose(){
      this.initData();
    }
  }
};
</script>
<style scoped>
.el-row {
  margin-top: 10px;
}
.el-col {
  line-height: 50px;
  text-align: left;
}
.el-input {
  width: 70%;
}
.el-dialog__body {
  padding-top: 0px;
  padding-bottom: 0px;
}

.slide-fade-enter-active {
  transition: all 0.8s ease;
}

.slide-fade-leave-active {
  transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
}

.slide-fade-enter,
.slide-fade-leave-to {
  transform: translateX(10px);
  opacity: 0;
}
.idcard {
  border-bottom: 1px solid #ccc;
}
.senior{
  margin-bottom: 10px;
  border: 1px;
  border-radius: 5px;
  border-style: solid;
  padding: 10px;
  box-sizing:border-box;
  border-color: #20a0ff
}
.senior .el-row{
  margin-bottom: 20px;
}
.senior .el-input{
  width:200px !important;
}
.senior .el-date-editor{
  width: 200px !important;
}
</style>
